package com.my.geojson.test.geoserver;


import it.geosolutions.geoserver.rest.GeoServerRESTManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;

import java.net.URL;

//@Configuration
public class GeoServerConfig {

    @Autowired
    private GeoServerProperties geoServerProperties;

    @Bean(name = "geoServerRESTManagerFactory")
    public GeoServerRESTManager geoServerRESTManagerFactory() {
        try {
            return new GeoServerRESTManager(
                    new URL(geoServerProperties.getEndpoint()),
                    geoServerProperties.getUsername(),
                    geoServerProperties.getPassword());
        } catch (Exception ex) {
            ex.printStackTrace();
            return null;
        }
    }
}

